package cn.claim.storage.tools;

/**
 * Created by claim on 17-7-13.
 */
public final class FileInfoDataBuilder {
    private String fileName;
    private String uuid;
    private String md5;
    private String serverName;
    private String backupServerName;
    private long length;

    private FileInfoDataBuilder() {
    }

    public FileInfoDataBuilder(FileInfoData data) {
        fileName = data.getFileName();
        uuid = data.getUuid();
        md5 = data.getMd5();
        serverName = data.getServerName();
        backupServerName = data.getBackupServerName();
        length = data.getLength();
    }

    public static FileInfoDataBuilder newInstance() {
        return new FileInfoDataBuilder();
    }

    public FileInfoDataBuilder withFileName(String fileName) {
        this.fileName = fileName;
        return this;
    }

    public FileInfoDataBuilder withUuid(String uuid) {
        this.uuid = uuid;
        return this;
    }

    public FileInfoDataBuilder withMd5(String md5) {
        this.md5 = md5;
        return this;
    }

    public FileInfoDataBuilder withServerName(String serverName) {
        this.serverName = serverName;
        return this;
    }

    public FileInfoDataBuilder withBackupServerName(String backupServerName) {
        this.backupServerName = backupServerName;
        return this;
    }

    public FileInfoDataBuilder withLength(long length) {
        this.length = length;
        return this;
    }

    public FileInfoData build() {
        return new FileInfoData(fileName, uuid, md5, serverName, backupServerName, length);
    }
}
